<template>
<div class="layerRtb layerRtb-threecolumn">
    <three-title :title="{name:'生产会'}"></three-title>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "137">
        <!-- 分司 -->
        <template v-if="Number(userInfo.u_diqu)!=39">
        <div class="analyItem">
            <p class="analyItemTit tx-center">会议</p>
            <div class="analyItemCon">
                <p class="col-md-4">生产会</p>
                <p class="col-md-4"><span class="cLightGray pr8">主持人</span>{{productionMeeting.userName}}</p>
                <p class="col-md-4"><span class="cLightGray pr8">会议时间</span>{{productionMeeting.createDate}}</p>
            </div>
        </div>
        <div class="analyItem">
            <p class="analyItemTit tx-center">会议内容</p>
            <div class="analyItemCon">{{productionMeeting.summ}}</div>
        </div>
        <div class="analyItem">
            <p class="analyItemTit tx-center">会议纪要</p>
            <div class="analyItemCon">
                <textarea class="col-md-12" rows="4" placeholder="请输入会议纪要" v-model="returnVisitSummary"></textarea>
            </div>
        </div>
        </template>
        <!-- 集团 -->
        <template v-else>
            <div class="analyItem">
                <p class="analyItemTit tx-center">会议</p>
                <div class="analyItemCon">
                    <p class="col-md-4">生产会</p>
                    <p class="col-md-4"><span class="cLightGray pr8">主持人</span>{{productionHandle.userName}}</p>
                    <p class="col-md-4"><span class="cLightGray pr8">会议时间</span>{{productionHandle.createDate}}</p>
                </div>
            </div>
            <div class="analyItem">
                <p class="analyItemTit tx-center">会议内容</p>
                <div class="analyItemCon">
                    {{productionHandle.summ}}
                </div>
            </div>
        </template>
    </div>
    <div class="layerRtb-footer">
        <!-- 分司 -->
        <div class="analyItem" v-if="Number(userInfo.u_diqu)!=39">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon tx-center">
                <input type="button" class="uiBtn-normal uiBtn-blue" value="确认" @click="addReturnVisit()">
            </div>
        </div>
        <!-- 集团 -->
        <template v-else>
         <div class="analyItem">
            <p class="analyItemTit tx-center">评估标准</p>
            <div class="analyItemCon">
                <p>优：1、上周任务验收情况详细描述，并落实奖罚</p>
                <p>良：以上内容基本齐全，描述较为详细，有验收有处理，有执行点，略不清晰</p>
            </div>
        </div>
        <div class="analyItem">
            <p class="analyItemTit tx-center">会议评估</p>
            <div class="analyItemCon">
                <p>
                    <el-radio-group v-model="radio">
                        <el-radio :label="4">优</el-radio>
                        <el-radio :label="3">良</el-radio>
                        <el-radio :label="2">中</el-radio>
                        <el-radio :label="1">差</el-radio>
                    </el-radio-group>
                </p>
                <div class="clearfix">
                    <textarea class="col-md-10" rows="4" placeholder="请输入评估内容" v-model="content"></textarea>
                    <input type="button" class="uiBtn-normal uiBtn-blue fr mt30" value="确定" @click="addEstimate()">
                </div>
            </div>
        </div>
        </template>
    </div>
</div>
</template>
<script>
import {mapGetters} from 'vuex'
import {findMeetingById, addReturnVisit, addEstimate} from '../../Resources/Api'
export default {
    data () {
        return {
            userInfo: this.$utils.getLocal('userInfo'),
            productionMeeting: {},
            returnVisitSummary: '',
            productionHandle: {},
            radio: '',
            content: ''
        }
    },
    computed: {
        ...mapGetters(['leftInfo'])
    },
    created () {
        this.productionMeeting = this.$route.query.productionMeeting
        this.findMeetingById()
    },
    methods: {
        findMeetingById () {
            findMeetingById({
                id: this.productionMeeting.id
            }).then(results => {
                this.productionHandle = results.data.result
            })
        },
        // 分司端提交会议内容
        addReturnVisit () {
            addReturnVisit({
                returnVisitType: '01', // 固定死值
                region: this.leftInfo.u_diqu,
                deptId: 3, // 部门编号 商务为 1 主案 2 工程 3 投资4
                returnVisitFlag: '工生',
                userName: this.$utils.getLocal('xinming'),
                cardNum: this.$utils.getLocal('u_kahao'),
                displayPosition: 0,
                returnVisitSummary: this.returnVisitSummary,
                returnVisitFlagId: 1,
                returnVisitState: 0
            }).then(results => {
                if (results.data.code >= 0) {
                    layer.msg('提交成功')
                }
            })
        },
        // 集团端审核内容
        addEstimate () {
            addEstimate({
                meetingId: this.productionMeeting.id,
                meetingLevel: this.radio,
                estimateSummary: this.content,
                cardNum: this.$utils.getLocal('u_kahao'),
                userName: this.$utils.getLocal('xinming')
            }).then(results => {
                if (results.data.code >= 0) {
                    layer.msg('提交成功')
                }
            })
        }
    }
}
</script>
<style>
.el-radio:nth-child(1) .el-radio__label{color: #00CC00!important;}
.el-radio:nth-child(2) .el-radio__label{color: #99cc00!important;}
.el-radio:nth-child(3) .el-radio__label{color: #FF9900!important;}
.el-radio:nth-child(4) .el-radio__label{color: #FF3333!important;}
.mt30{margin-top:30px;}
</style>
